package pooh;

import java.sql.SQLException;
import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;

import com.ibatis.sqlmap.client.SqlMapClient;

import comm.util.SqlMapLoader;

public class PoohTestProc {
	public PoohTestProc() {}
	
	private SqlMapClient sqlMapper = SqlMapLoader.getInstance();
	
	public String insertTest(HttpServletRequest request){
		String content = request.getParameter("inputText") + String.valueOf(Math.random());
		try {
			System.out.println("들어온값 : "+ content);
			
			sqlMapper.insert("Pooh_test.insertTest",content);
			return "SUCESS";
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return "ERROR";
		}
	}
	
	public ArrayList selectTestList(){
		ArrayList lt = null;
		
		try {
			lt = (ArrayList)sqlMapper.queryForList("Pooh_test.selectTestList");
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return lt;
	}
}